package Person;

use warnings;
use strict;

# Class Data
my $Everyone = [];

# Constructor and initialisation
sub new
{
	my ( $class, $name, $address, $phone ) = @_;
	my $self = {
		name    => $name,
		address => $address,
		phone   => $phone
	};

	bless( $self, $class );
	$self->init();

	return $self;
}

sub init
{
	my ($self) = @_;
	push @$Everyone, $self;
	print "In Person: New object created\n";
}

# Object accessor methods

sub name
{
	my ( $self, $name ) = @_;
	$self->{name} = $name if defined $name;
	return $self->{name};
}

sub address
{
	my ( $self, $address ) = @_;
	$self->{address} = $address if defined $address;
	return $self->{address};
}

sub phone
{
	my ( $self, $phone ) = @_;
	$self->{phone} = $phone if defined $phone;
	return $self->{phone};
}

# Class accessor methods
sub headcount
{
	return scalar @$Everyone;
}

# Utility methods

sub fullname
{
	my ($self) = @_;
	return $self->{forename} . " " . $self->{surname};
}

# Overriding Merthods

sub display
{
	my ($self) = @_;
	print "In Person:display\n";
} 

sub getAssistPerson
{
	my ($self) = @_;
	return undef;
}
1;
